//
//  CalulateManager.m
//  runtime
//
//  Created by dihuijun on 17/4/14.
//  Copyright © 2017年 Cycle. All rights reserved.
//

#import "CalulateManager.h"

@implementation CalulateManager
/**  初始化 */
+ (instancetype)sharedCalulateManager{
    static CalulateManager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[self alloc]init];
    });
    return manager;
}


/**  加法  add*/
- (__kindof CalulateManager *(^)(double))add{
    //返回值为block
    return ^(double value){
        _result+=value;
        return self;
    };
}

/**  减法  sub*/
- (__kindof CalulateManager *(^)(double))sub{
    return ^(double value){
        _result-=value;
        return self;
    };
}
/**  乘法  mult*/
- (__kindof CalulateManager *(^)(double))mult{
    return ^(double value){
        _result*=value;
        return self;
    };
}
/**  除法  divs*/
- (__kindof CalulateManager *(^)(double))divs{
    return ^(double value){
        _result/=value;
        return self;
    };
}
@end
